#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time    : 2020/6/15 13:52
# @Author  : JY.Liu
# @Site    : http://github.com/lh1993
# @Mail    : lhln0119@163.com
# @File    : get_config.py
# @Software: PyCharm

import configparser
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
configpath = os.path.join(BASE_DIR, "config")
configpath = os.path.join(configpath, "config.ini")

cf = configparser.RawConfigParser()
cf.read(configpath)

# aliyun
apikey = cf.get('aliyun', 'apikey')
apisecret = cf.get('aliyun', 'apisecret')
# region = cf.get('aliyun', 'region')
vpc_sls_region = cf.get('aliyun', 'vpc_sls_region')
project = cf.get('aliyun', 'project')
# time_range = int(cf.get('aliyun', 'time_range'))
query = cf.get('aliyun', 'query')
black_logstore = cf.get('aliyun', 'black_logstore')

# wechat
url = cf.get('wechat', 'url')
touser = cf.get('wechat', 'touser')
toparty = cf.get('wechat', 'toparty')
totag = cf.get('wechat', 'totag')
agentid = cf.get('wechat', 'agentid')

# db
host = cf.get('db', 'host')
user = cf.get('db', 'user')
passwd = cf.get('db', 'passwd')
dbname = cf.get('db', 'dbname')

# redis
redis_host = cf.get('redis', 'host')
redis_port = cf.get('redis', 'port')
redis_db = cf.get('redis', 'db')

# other
time_range = cf.getint('other', 'time_range')
expire_second = cf.get('other', 'expire_second')
check_period = cf.get('other', 'check_period')
trigger_counts = cf.get('other', 'trigger_counts')
# online_ip = cf.get('other', 'online_ip')
max_abnormal_ua_counts = cf.getint('other', 'max_abnormal_ua_counts')

# special
ignore_list = cf.items('special')
